

export default {
    methods:{
        /**
         * 切换多行记录导出。
         * @param {{Api:Object,id:"",table:""}} conf 配置数据
         */
        changeExport(conf){
            let self_=this;
            let {id,Api}=conf;
            let aryId=this.selectedRows.map(item=>{
                return item[id];
            });
            let ids=aryId.join(",");
            Api.updExport(ids).then(res=>{
                self_.$message.success(res.message);
                if(conf.table){
                    self_.$refs[conf.table].selectedRowKeys = [];
                    self_.$refs[conf.table].selectedRows = [];
                }
                else{
                    self_.$refs.table.selectedRowKeys = [];
                    self_.$refs.table.selectedRows = [];
                }

                this.selectedRowKeys=[];
                this.selectedRows=[];

                self_.loadData();
            });

        },
        /**
         * 切换单条记录导出
         * @param {{Object}} record 导出的记录对象
         * @param {{ Api:Object,id:""}} conf 配置数据
         */
        setExport(record,conf) {
            let self_ = this;
            let {id,Api}=conf;
            let ids=record[id];
            Api.updExport(ids).then(res => {
                self_.$message.success(res.message);
                self_.loadData();
            });
        }
    }
}